package edu.cuit.avatar.array;

public class Deck {
    public static void main(String[] args) {
        //初始化一副牌
        int[] deck = new int[52];
        for(int i = 0; i < deck.length; i++)
            deck[i] = i;

        //洗牌(随机打乱)
        for(int i = 0; i < deck.length; i++){
            int j = (int)(Math.random() * deck.length);
            int temp = deck[i];
            deck[i] = deck[j];
            deck[j] = temp;
        }

        String suits[] = {"♠", "♥", "♣", "♦"};
        String[] ranks = {"A","2","3","4","5","6","7","8","9","10","J","Q","K"};
        //每隔三张取一张牌，取三张
        for(int i = 0; i < 3; i++){
            int deckNumber = deck[i * 3];
            System.out.println(suits[deckNumber / 13] + "  " + ranks[deckNumber % 13]);
        }
    }
}
